package zheezes.protocol.impl.wt;


public class WtLoginFrame extends WtFrame {
	public static final int PWD_LEN = 3;

	private byte[] pwd = new byte[PWD_LEN];

	public WtLoginFrame() {
		ctrl = (byte) 0xA1;
	}
	
	@Override
	public WtConAddr getRtua() {
		return null;
	}

	@Override
	public void setRtua(WtConAddr rtua) {
	}

	@Override
	public WtMstAddr getMsta() {
		return new WtMstAddr(rtua.getBytes()[2]);
	}

	@Override
	public void setMsta(WtMstAddr msta) {
		byte[] tmp = rtua.getBytes();
		tmp[1] &= 0xE0;
		tmp[2] = msta.getData();
		rtua.setBytes(tmp, 0, tmp.length);
	}

	public int sizeOfData() {
		return PWD_LEN;
	}

	public int getData(byte[] buf, int offset) {
		System.arraycopy(buf, offset, pwd, 0, PWD_LEN);
		return PWD_LEN;
	}

	public int setData(byte[] buf, int offset, int max) {
		System.arraycopy(pwd, 0, buf, offset, PWD_LEN);
		return PWD_LEN;
	}

	public void setPwd(byte[] pwd) {
		System.arraycopy(pwd, 0, this.pwd, 0, PWD_LEN);
	}
}
